package com.itcm.skymail.product.web;

import com.itcm.skymail.product.service.SkuInfoService;
import com.itcm.skymail.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * 描述: 详情展示
 *
 * @author cm_fighting
 * @create 2020-11-03 2:46 下午
 */

@Controller
public class ItemController {
    @Autowired
    private SkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    public String item(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        System.out.println("sku id is : " + skuId);
        SkuItemVo item = skuInfoService.item(skuId);
        System.out.println(item);
        model.addAttribute("item", item);
        return "item";
    }
}
